import {createRouter, createWebHistory} from 'vue-router'
import Home from "../view/Home.vue";


const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: "/",
            name: "home",
            redirect:'/autoChange'
        },
        {
            path: "/autoChange",
            name: "autoChange",
            component: () =>
                import("../view/auto/AutoChange.vue"),
        },
        {
            path: "/autoChangeRecords",
            name: "autoChangeRecords",
            component: () =>
                import("../view/auto/AutoChangeRecords.vue"),
        },

    ],
});

// currentUrl存储在内存中
router.beforeResolve((to, from, next) => {

    if (from.path === to.path) {
        console.log("重复点击" + from.path + "==>" + to.path)
        return;
    }
    next()
})

export default router
